import urllib3
import threading


class Base:

    _url_formatter = 'https://%s.58.com/zufang/0/%s/'

    def __init__(self, proxy, city, callback=None):
        if proxy:
            self._http = urllib3.ProxyManager(proxy)
        else:
            self._http = urllib3.PoolManager()
        self._city = city
        self._callback = callback
        self.thread = threading.Thread(target=self._loop, args=(self, ))
        self.thread.start()

    @staticmethod
    def _loop(self):
        self.run()

    def run(self):
        pass
